/*
 * @Author: wanliofficial wanliofficial@aliyun.com
 * @Date: 2024-11-01 10:35:39
 * @LastEditors: wanliofficial wanliofficial@aliyun.com
 * @LastEditTime: 2025-02-21 14:36:18
 * @FilePath: \onetest-winx64d:\projects\leming\MeterSphere\project-management\backend\src\main\java\io\metersphere\config\KafkaTopicConfig.java
 * @Description: 
 * 
 * Copyright (c) 2025 by ${git_name_email}, All Rights Reserved. 
 */
package io.metersphere.config;

import io.metersphere.commons.constants.KafkaTopicConstants;
import org.apache.kafka.clients.admin.NewTopic;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.kafka.config.TopicBuilder;

@Configuration
public class KafkaTopicConfig {
    @Value("${kafka.partitions:3}")
    private Integer partitions;
    @Value("${kafka.replicas:1}")
    private Integer replicas;

    @Bean
    public NewTopic cleanUpReportTopic() {
        return TopicBuilder.name(KafkaTopicConstants.CLEAN_UP_REPORT_SCHEDULE)
                .partitions(partitions)
                .replicas(replicas)
                .build();
    }
}
